<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="./vue2.js"></script>
</head>

<body>
    <div id="app">
        <father></father>
    </div>
    <script>
        Vue.component("father", {
            template: `
                <div>
                    <p> 我是父组件，我给我儿子起名叫：{{mySonName}} </p>
                    <son :myName='mySonName'></son>
                </div>
            `,
            data() {
                return {
                    mySonName: "小明"
                }
            },
            components: {
                son: {
                    props: ["myName"],
                    template: "<p>我是子组件，我爸爸给我起名叫:{{myName}}</p>"
                }
            }
        });
        var vm = new Vue({
            el: '#app',
            data: {

            }
        })
    </script>
</body>

</html>